home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / MacScheme20 / Compatibility / misc.sch < prev    next >
Encoding:
Text File  |  1988-12-24  |  960 b   |  27 lines  |  [TEXT/EDIT]

  1. ; The following predicate takes a symbol naming a variable
  2. ; and returns #t if the global variable named by that variable
  3. ; is currently defined.
  4.  
  5. ; This procedure will have to be redefined for future versions
  6. ; of MacScheme.
  7.  
  8. (define (defined? name)
  9.   (cond ((assq name **primops**) #t)
  10.         (else (not (eq? (car (->pair name)) (undefined))))))
  11.  
  12. ; Include macro for getting around MacScheme's 32K editor limitation.
  13. ; (include <filename>) macro-expands into (begin <contents of file>).
  14. ; The compiler flattens begin expressions that contain nothing but
  15. ; definitions, allowing a set of definitions to be placed in a separate
  16. ; file.  This favors internal definitions over the letrec syntax.
  17.  
  18. (macro include
  19.        (lambda (l)
  20.          (call-with-input-file
  21.           (cadr l)
  22.           (lambda (p)
  23.             (do ((x (read p) (read p))
  24.                  (l '() (cons x l)))
  25.                 ((eof-object? x)
  26.                  (cons 'begin (reverse l))))))))
  27.